<template>
  <nf-form
    v-form-drag="extendFormProps"
    :model="model"
    :partModel="partModel"
    v-bind="extendFormProps"
  >
  </nf-form>
</template>

<script>
  import { reactive, defineComponent } from 'vue'
  import { nfForm } from '../../map'
  import { getItemState } from '../state-item'
  import myWatch from './controller'
  import item_select from '../json/item-select.json'

const _temp = {
  160: `<el-select
  v-model="select"
  v-bind="itemProps"
/>`,
  161: `<el-select
  v-model="select"
  v-bind="itemProps"
  multiple
/>`,
  162: `<el-select
  v-model="value"
  v-bind="itemProps"
>
  <el-option-group
    v-for="group in options"
    :key="group.label"
    :label="group.label"
  >
    <el-option
      v-for="item in group.options"
      :key="item.value"
      :label="'　　' + item.label"
      :value="item.value"
    >
    </el-option>
  </el-option-group>
</el-select>`,
  163: `<el-select
  v-model="value"
  v-bind="itemProps"
  multiple
>
  <el-option-group
    v-for="group in options"
    :key="group.label"
    :label="group.label"
  >
    <el-option
      v-for="item in group.options"
      :key="item.value"
      :label="'　　' + item.label"
      :value="item.value"
    >
    </el-option>
  </el-option-group>
</el-select>`,
  164: `<el-cascader
  v-model="value"
  v-bind="itemProps"
>
</el-cascader>`,
  165: `<el-select
  v-model="select"
  v-bind="itemProps"
/>`
}

  export default defineComponent({
    name: 'nf-meta-help-item-extend-select',
    inheritAttrs: false,
    components: {
      nfForm
    },
    props: {
      temp: Object // 返回模板
    },
    setup(props) {
      const state = getItemState()
        
      // 文本类扩展属性表单，需要的 meta
      const extendFormProps = reactive(item_select)
      
      const {
        setup,
        model,
        partModel,
      } = myWatch(props)

      setup(model)
      
      return {
        state,
        model,
        partModel,
        extendFormProps
      }
    }
  })

</script>